var domain = 'https://epay.zzmind.cn/api'
let s5 = app = {
	initData(params, callback) {
		url = domain + params.url;
		type = params.type || 'get';
		data = params.data || [];
		// console.log(data);
		$.ajax({
			url,
			type,
			data,
			contentType: "application/x-www-form-urlencoded; charset=UTF-8",

			success: function(res) {
				return callback && callback(res)
			},
			error: function(res) {
				console.log(JSON.stringify(res))
			}
		})
	},
	store: {
		set(key, value) {
			localStorage.setItem(key, JSON.stringify(value));
		},
		get(key) {
			return JSON.parse(localStorage.getItem(key));
		},
		del(key) {
			return localStorage.removeItem(key);
		}
	},
}
if (client_type == 'wechat') {
	wx.ready(() => {
		console.log('wx ready')
		wx.getLocation({
			type: 'gcj02', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
			success: function(res1) {
				var latitude = res1.latitude; // 纬度，浮点数，范围为90 ~ -90
				var longitude = res1.longitude; // 经度，浮点数，范围为180 ~ -180。
				var speed = res1.speed; // 速度，以米/每秒计
				var accuracy = res1.accuracy; // 位置精度
				localStorage.setItem("lat", latitude)
				localStorage.setItem("lng", longitude)
			},
			cancel: function(res) {
				alert('用户拒绝授获取地理位置');
			},
			fail: function(res) {
				alert(res.errMsg)
			}
		});
	});
	wx.error(function(res) {
		console.log('err', res)
	});
} else if (client_type == 'alipay') {
	ap.getLocation(function(res) {
		localStorage.setItem("lat", res.latitude);
		localStorage.setItem("lng", res.longitude);
		// alert(JSON.stringify(res, undefined, '  '));
	});
}



